<template>
  <div class="app-container">
    <el-form :inline="true" :model="form" class="demo-form-inline">
      <el-form-item label="收房合同编号">
        <el-input v-model="form.sfContractNo" placeholder="收房合同编号"></el-input>
      </el-form-item>
      <el-form-item label="业主姓名">
        <el-input v-model="form.ownerName" placeholder="业主姓名"></el-input>
      </el-form-item>
      <el-form-item label="小区名称">
        <el-input v-model="form.premiseName" placeholder="校区名称"></el-input>
      </el-form-item>
      <el-form-item label="合同录入日期">
        <el-col :span="11">
          <el-date-picker type="date" placeholder="选择日期" v-model="form.t1" style="width: 100%;"></el-date-picker>
        </el-col>
        <el-col class="line" :span="2">至</el-col>
        <el-col :span="11">
          <el-date-picker type="date" placeholder="选择日期" v-model="form.t2" style="width: 100%;"></el-date-picker>
        </el-col>
      </el-form-item>
      <el-form-item>
        <el-button type="success" @click="onSubmit">查询</el-button>
        <el-button type="warning" plain @click="empty">重置</el-button>
      </el-form-item>
    </el-form>
    <el-table
      :data="tableData"
      style="width: 100%">
      <el-table-column
        prop="sfContractNo"
        label="合同编号"
        width="180">
      </el-table-column>
      <el-table-column
        prop="premiseName"
        label="小区"
        width="180">
      </el-table-column>
      <el-table-column
        prop="signUserMobile"
        label="电话">
      </el-table-column>
      <el-table-column
        prop="leaseStartTime"
        label="起租日期">
      </el-table-column>
      <el-table-column
        prop="leaseEndTime"
        label="结束日期">
      </el-table-column>
      <el-table-column
        prop="conInfoTime"
        label="录入日期">
      </el-table-column>
      <el-table-column
        prop="conAudTime"
        label="审核日期">
      </el-table-column>
      <el-table-column
        prop="ownerName"
        label="业主">
      </el-table-column>
      <el-table-column
        prop="username"
        label="操作人">
      </el-table-column>
    </el-table>
    <el-pagination
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
      :current-page="form.pageNum"
      :page-sizes="[10,20]"
      :page-size="form.pageSize"
      layout="total, sizes, prev, pager, next, jumper"
      :total="total">
    </el-pagination>
  </div>
</template>

<script>
export default {
  created() {
      this.init()
  },
  data() {
    return {
      tableData: [],
      total:null,
      form:{
        pageNum:null,
        pageSize:null,
        sfContractNo:'',
        ownerName:'',
        premiseName:'',
        conInfoTime:'',
        t1:null,
        t2:null
      }
    }
  },
  methods: {
    init(){
      console.log(this.form.ownerName)
      this.axios.get("http://127.0.0.1/api/shou/wish/t-sf-contract/list",{params:this.form}).then((response)=>{
        this.tableData=response.data.obj.list
        this.form.pageNum=response.data.obj.pageNum
        this.form.pageSize=response.data.obj.pageSize
        this.total=response.data.obj.total
      })
    },
    handleSizeChange(val) {
      console.log(`每页 ${val} 条`);
      this.form.pageSize=val
      this.init()
    },
    handleCurrentChange(val) {
      console.log(`当前页: ${val}`);
      this.form.pageNum=val
      this.init()
    },
    onSubmit() {
      console.log("11")
      this.init()
    },
    empty(){
      this.form.sfContractNo=''
      this.form.ownerName=''
      this.form.premiseName=''
      this.form.t1=null
      this.form.t2=null
    }
  }
}
</script>

<style scoped>

</style>
